<?php

namespace App\Models;

use Illuminate\Database\Eloquent\Factories\HasFactory;
use Illuminate\Database\Eloquent\Model;
use Illuminate\Database\Eloquent\SoftDeletes;
use Jedrzej\Pimpable\PimpableTrait;

class UserSign extends Model
{
    use HasFactory;
    use PimpableTrait;
    /**
     * 默认排序
     */
    protected $defaultSortCriteria = ['id,desc'];

    /**
     * 可排序字段
     */
    public $sortable = [
        'created_at',
        'id',
        'number',
        'balance',
        'count',
    ];

    /**
     * 可搜索字段
     */
    public $searchable = [
        'user_id',
        'title',
        'number',
        'balance',
        'count',
    ];
    /**
     * 用户签到表可批量赋值字段
     */
    protected $fillable = [
        'user_id',
        'title',
        'number',
        'balance',
        'count',
    ];
    /**
     * 签到用户
     */
    public function userSign(){
        return $this->belongsTo(User::class,'user_id','id');
    }
}
